package models

// RolePermission [...]
type RolePermission struct {
	RoleID       uint       `gorm:"index:role_id;column:role_id;type:int unsigned;not null" json:"roleId"`
	Role         Role       `gorm:"joinForeignKey:role_id;foreignKey:id" json:"roleList"`
	PermissionID uint       `gorm:"index:permission_id;column:permission_id;type:int unsigned;not null" json:"permissionId"`
	Permission   Permission `gorm:"joinForeignKey:permission_id;foreignKey:id" json:"permissionList"`
}

// TableName get sql table name.获取数据库表名
func (m *RolePermission) TableName() string {
	return "role_permission"
}

// RolePermissionColumns get sql column name.获取数据库列名
var RolePermissionColumns = struct {
	RoleID       string
	PermissionID string
}{
	RoleID:       "role_id",
	PermissionID: "permission_id",
}
